import pandas as pd
import matplotlib.pyplot as plt

data = pd.read_excel('男子体能测试成绩.xlsx')
grades = data['成绩等级']
grade_counts = grades.value_counts()
plt.figure(figsize=(8, 8))
plt.pie(grade_counts, autopct='%1.1f%%', startangle=90,
        pctdistance=0.9, textprops={'fontsize': 13, 'color': 'w'})
plt.title('男子体能测试成绩等级占比饼图', fontsize=20)
plt.rcParams['font.sans-serif'] = 'SimHei'
plt.legend(grade_counts.index)
plt.show()
